package com.tybbank.Adapter;

import android.app.Activity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;


import com.tybbank.R;

import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * Created by plh
 * on 2018/5/28 0028.
 */

public class UpdateContentAdapter extends BaseAdapter {

    private Activity activity;
    private List<String> data;

    public UpdateContentAdapter(Activity activity, List<String> data) {
        this.activity = activity;
        this.data = data;
    }


    @Override
    public int getCount() {
        return data.size();
    }

    @Override
    public Object getItem(int position) {
        return data.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder holder;
        if (convertView == null) {
            convertView = LayoutInflater.from(activity).inflate(R.layout.item_dialog_update_content, null);
            holder = new ViewHolder(convertView);
            convertView.setTag(holder);
        } else {
            holder = (ViewHolder) convertView.getTag();
        }
        holder.tvItemUpdateContents.setText((position + 1) + "、" + data.get(position));
        return convertView;
    }


    class ViewHolder {
        @BindView(R.id.tv_item_update_contents)
        TextView tvItemUpdateContents;

        ViewHolder(View view) {
            ButterKnife.bind(this, view);
        }
    }
}
